package com.bjpowernode.config;

import com.bjpowernode.model.QueueConstant;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SpikeMQConfig {

    @Bean
    public Queue spikeQueue() {
        return new Queue(QueueConstant.SPIKE_QUEUE);
    }

    @Bean
    public DirectExchange spikeEx() {
        return new DirectExchange(QueueConstant.SPIKE_EX);
    }

    @Bean
    public Binding spikeBind() {
        return BindingBuilder.bind(spikeQueue()).to(spikeEx()).with(QueueConstant.SPIKE_KEY);
    }

}
